home *** CD-ROM | disk | FTP | other *** search
- Path: cedarnet.cedarville.edu!usenet
- From: Tim Hansell <hansellt@cedarville.edu>
- Newsgroups: comp.lang.c
- Subject: Re: macro that return value, how?
- Date: Mon, 04 Mar 1996 15:29:45 -0800
- Organization: Cedarville College
- Message-ID: <313B7CE9.4876@cedarville.edu>
- References: <3133e87b.868433@news.csus.edu> <3136FA60.350B@cmt.lpr.mail.carel.fi> <TANMOY.96Mar1091759@qcd.lanl.gov>
- NNTP-Posting-Host: hansellt2.cedarville.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Tanmoy Bhattacharya wrote:
- > Ari Lukumies <aril@cmt.lpr.mail.carel.fi> writes:
- > <snip>
- AL: This will compile:
- AL:
- AL: #define add1(x) (x += VAR)
- AL:
- AL: Remember, the result of an assignment is implicitly returned. So,
- you can use
- AL: constructs like:
- <snip>
- AL: and
- AL: if (add1(2) == 2)
- AL: DoSomething...
-
- I could not get this snippet to compile with Borland C 4.5
-
- It complaines on any statment using "add1(2)" that
- the "LVALUE" is incorrect.
-
- Which I take to mean that the resulting statement..
-
- "2 += 2 ;"
-
- doesn't have a variable on the left hand side of the assignment...
- so it won't compile ...
-
- What compiler did you use ?
-
- -tim
-